// 用户相关请求模块

import request from '@/utils/api/request'
// 使用qs：将数据序列化成url格式
import qs from 'qs'
// 获取签到信息列表
export const AllSign = () => {
  return request({
    method: 'GET',
    url: `/signIn/getList`,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}

export function createPublish (data) {
  return request({
    method: 'POST',
    url: `/signIn/create`,
    data: qs.stringify(data),
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    }
  })
}

export function getCreateSign () {
  return request({
    method: 'get',
    url: `/signIn/getCreatedList`,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    }
  })
}

// 删除签到
export function deleteSign (data) {
  return request({
    method: 'POST',
    url: `/signIn/delete/${data}`,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    }
  })
}

// 一键签到
export const InSign = data => {
  return request({
    method: 'POST',
    url: `/signIn/directly?sign_id=` + data,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}
// 界面隐藏签到信息
export const popSign = data => {
  return request({
    method: 'POST',
    url: `/signIn/hide/` + data,
    // data: qs.stringify(data),
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    }
  })
}

// 显示打卡详情
export function showSignDetail (data) {
  return request({
    method: 'GET',
    url: `/signIn/getCreatedDetails?sid=${data}`,
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded',
    }
  })
}
